/*******************************************************************************
*
*               COPYRIGHT (c) 2015-2016 Broadlink Corporation
*                         All Rights Reserved
*
* The source code contained or described herein and all documents
* related to the source code ("Material") are owned by Broadlink
* Corporation or its licensors.  Title to the Material remains
* with Broadlink Corporation or its suppliers and licensors.
*
* The Material is protected by worldwide copyright and trade secret
* laws and treaty provisions. No part of the Material may be used,
* copied, reproduced, modified, published, uploaded, posted, transmitted,
* distributed, or disclosed in any way except in accordance with the
* applicable license agreement.
*
* No license under any patent, copyright, trade secret or other
* intellectual property right is granted to or conferred upon you by
* disclosure or delivery of the Materials, either expressly, by
* implication, inducement, estoppel, except in accordance with the
* applicable license agreement.
*
* Unless otherwise agreed by Broadlink in writing, you may not remove or
* alter this notice or any other notice embedded in Materials by Broadlink
* or Broadlink's suppliers or licensors in any way.
*
*******************************************************************************/

#ifndef __DNA_HARDTIMER_H
#define __DNA_HARDTIMER_H

#ifdef __cplusplus
    extern "C" {
#endif

/*
*   These hardware timer using 32KHz as clock source,
*   So 1 count = 30.5us and the max count = 0xFFFFFFFF (130997s).
*/

enum {
    DNA_HARDTIMER_0 = 0,
    DNA_HARDTIMER_1,
    DNA_HARDTIMER_2,
    DNA_HARDTIMER_3,
    DNA_HARDTIMER_4,
};

int dna_hardtimer_init(int timerid);
int dna_hardtimer_deinit(int timerid);
int dna_hardtimer_start(int timerid, unsigned long us,
    void (* callback)(void * arg), void * arg);
int dna_hardtimer_stop(int timerid);
unsigned long dna_hardtimer_counterval_get(int timerid);

#ifdef __cplusplus
}
#endif

#endif

